import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

public class Window extends JPanel implements ActionListener
{

    public Image roof;

    public Image city;
    public Image cl;
    
    public Star sky = new Star();
    public Signal signal = new Signal();
    public Riddle riddle = new Riddle(50, 308);
    public Rope rope = new Rope(230, 380);
    public Batman batman = new Batman(280, 250);

    public Window () {

        addMouseListener(signal);
        addMouseListener(riddle);
        addMouseListener(rope);
        addMouseListener(batman);
        
        Timer metronome = new Timer(25, this);
		metronome.start();
    
        ImageIcon pic2 = new ImageIcon(getClass().getResource("./roof.png"));

        ImageIcon cityicon = new ImageIcon(getClass().getResource("./city.png"));
        ImageIcon cloudsicon = new ImageIcon(getClass().getResource("./clouds.png"));
        
        city = cityicon.getImage();
        roof = pic2.getImage();

        cl = cloudsicon.getImage();
    }
    public void paintComponent(Graphics g)
    {
        g.setColor(Color.black);
        g.fillRect(0,0,600,500);
        sky.paintStars(g);
        g.drawImage(cl,0,0,this);
        g.drawImage(city, 0, 200, this);
        
        g.drawImage(roof, 0, 322, this);
        batman.paint(g);
        signal.paint(g);
        riddle.paint(g);
        rope.paint(g);
    }

    public void actionPerformed(ActionEvent e) {
		repaint();
	}
}
